{extend name="public:base" /}
{block name="content"}
<div class="page-header">
	<h1>
		{$breadcrumb1}
		<small>
			<i class="ace-icon fa fa-angle-double-right"></i>
			{$breadcrumb2}
		</small>
		<small>
			<i class="ace-icon fa fa-angle-double-right"></i>
			{$crumbs}
		</small>			
	
	</h1>
</div>

<div class="row">
	<div class="col-xs-12">	
		
		<div class="form-horizontal">
			
			{if condition="$Request.param.id"}
			<input name="id" type="hidden" value="{$Request.param.id}" />
			{/if}
			
			<div class="form-group">
				<label class="col-sm-1 control-label no-padding-left"> * 品种名称 </label>
			<div class="col-sm-11">
				<div class="clearfix">
				<input name="name" id="name" class="col-xs-10 col-sm-12"  value="{$d.name|default=''}" type="text">
				</div>
			</div>
			</div>
			<div class="space-4"></div>

			<div class="form-group">
				<label class="col-sm-1 control-label no-padding-left"> * 品种编号 </label>
			<div class="col-sm-11">
				<div class="clearfix">
				<input name="variety_id" id="variety_id" class="col-xs-10 col-sm-12"  value="{$d.variety_id}" type="text">
				</div>
			</div>
			</div>
			<div class="space-4"></div>		
			<div class="form-group">
				<label class="col-sm-1 control-label no-padding-left"> * 交易所 </label>
			<div class="col-sm-11">
				<div class="clearfix">
				<select name="cid">							
						{volist name="exchange" id="c"}
							<option {if condition="isset($d) and ($c['id'] eq $d['exchange_id'])"} selected="selected"{/if} value="{$c.id}">{$c.name}</option>
						{/volist}							
				</select>
				</div>
			</div>
			</div>
			<div class="space-4"></div>
		
			
			
			
			<div class="form-group">
                <label class="col-sm-1 control-label" for="input-description">备注</label>
                <div class="col-sm-11">
                  <textarea name="content" id="description">{$d.remark|default=''}</textarea>	
                </div>
          	</div>

			
			<div class="form-group">
				<label class="col-sm-1 control-label no-padding-left"> </label>	
				<div class="col-sm-11">
					<input id="send" type="submit" value="提交" class="btn btn-primary" />
				</div>
			</div>
		</div>
	</div>
</div>
{/block}
{block name="javascript"}
<script src="__PUBLIC__/js/ckeditor/ckeditor.js"></script> 
<script>
CKEDITOR.replace('description', {
	filebrowserImageUploadUrl: '{:url("FileManager/ckupload")}',
	toolbar: [
				[ 'Source', 'Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat' ],
				[ 'FontSize', 'TextColor', 'BGColor' ],
				[ 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock','Image','Format']
			]	
});

var back_index="{:url('variety/index')}";

$('#send').click(function(){
	$.post(
		'{$action}',
		{
			<?php if(input('param.id')){ ?>
				id:$("input[name='id']").val(),
			<?php } ?>
			
			cid:$("select").val(),	
			cid:$("select").val(),				
			name:$("input[name='name']").val(),
			variety_id:$("input[name='variety_id']").val(),
			content:$("textarea[name='content']").val(),
			seo_keywords:$("textarea[name='seo_keywords']").val(),
			seo_description:$("textarea[name='seo_description']").val(),
			content:CKEDITOR.instances.description.getData()
		},
		function(d){
			art_dialog(d,back_index);
		}
	);
});
</script>							
{/block}